<menu id="8mwcu"></menu>
  • <rt id="8mwcu"><code id="8mwcu"></code></rt><center id="8mwcu"><dd id="8mwcu"></dd></center>
    <center id="8mwcu"></center>
    <dl id="8mwcu"></dl><tbody id="8mwcu"><small id="8mwcu"></small></tbody>
    
    
    <tbody id="8mwcu"></tbody>
     
    ????????INFO
    ???????CONTACT

    ???????????????????·?′???22??101

    ?綽??13592986386

    jQuery AJAX??????????????????????λ?????? > jQuery AJAX???????????????

    jQuery AJAX???????????????

    ???????2015/3/2 9:34:23

    jQuery AJAX???????????????

    1.???demo.aspx??檔
    2.????????????????demos.aspx.cs????????á?

    using System.Web.Services;
    3.??????????????.
    ?????????????汾???????.net framework 2.0??2.0???2?????? ???????
    [WebMethod] public static string SayHello()     
    { return "Hello Ajax!";     
    }    
    JS????
    ???????
    $(function() {     
        $("#btnOK").click(function() {     
            $.ajax({ //???post???   type: "Post", //?????????????????   url: "Demo.aspx/SayHello",     
                contentType: "application/json; charset=utf-8",     
                dataType: "json",     
                success: function(data) { //???????????data.d???????   alert(data.d);     
                },     
                error: function(err) {     
                    alert(err);     
                }     
            }); //???e??????   return false;     
        });     
    });   
    ???????
    ??????
        <form id="form1" runat="server">
        <div>
            <asp:Button ID="btnOK" runat="server" Text="??????" />
        </div>
        </form>
    ????Ч?????£? 

    3.?в???????????
    ???????
    [WebMethod] public static string GetStr(string str, string str2)     
    { return str + str2;     
    } 
    JS????
    ???????
    $(function() {     
        $("#btnOK").click(function() {     
            $.ajax({     
                type: "Post",     
                url: "demo.aspx/GetStr", //???????ε?д?????????str??βε?????,str2???????βε?????   data: "{'str':'????','str2':'XXX'}",     
                contentType: "application/json; charset=utf-8",     
                dataType: "json",     
                success: function(data) { //???????????data.d???????   alert(data.d);     
                },     
                error: function(err) {     
                    alert(err);     
                }     
            }); //???e??????   return false;     
        });     
    });    
    ???????
    ????Ч?????£?

    4.???????鷽??
    ???????

    ???????
    [WebMethod] public static List<string> GetArray()     
    {     
        List<string> li = new List<string>(); for (int i = 0; i < 10; i++)     
            li.Add(i + ""); return li;     
    }    
    ???????

    JS????

    ???????
    $(function() {     
        $("#btnOK").click(function() {     
            $.ajax({     
                type: "Post",     
                url: "demo.aspx/GetArray",     
                contentType: "application/json; charset=utf-8",     
                dataType: "json",     
                success: function(data) { //??????????ul   $("#list").html(""); //?????????   $(data.d).each(function() { //????????li????   $("#list").append("<li>" + this + "</li>");     
                    });     
        
                    alert(data.d);     
                },     
                error: function(err) {     
                    alert(err);     
                }     
            }); //???e??????   return false;     
        });     
    }); 
    ???????

    ??????

    ?
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="btnOK" runat="server" Text="??????" />
    </div>
    <ul id="list">
    </ul>
    </form>

    ???н?????

    美丽人妻中文字幕中出在线,97婷婷视频在线,亚洲精品午夜无码专区,人人九九精品国产 国产黄色视频在线播 亚洲精品91天天久久人人
    <menu id="8mwcu"></menu>
  • <rt id="8mwcu"><code id="8mwcu"></code></rt><center id="8mwcu"><dd id="8mwcu"></dd></center>
    <center id="8mwcu"></center>
    <dl id="8mwcu"></dl><tbody id="8mwcu"><small id="8mwcu"></small></tbody>
    
    
    <tbody id="8mwcu"></tbody>